﻿namespace EyeOpen.TimeAssistant.Data.Nhibernate.Mapping
{
    using EyeOpen.Data.Nibernate.Mapping;
    using EyeOpen.TimeAssistant.Domain;

    public class UserStoryMap : OwnedHistoryMap<UserStory>
    {
        protected UserStoryMap()
        {
            Map(x => x.Name)
                .Not.Nullable();

            Map(x => x.Priority)
                .Not.Nullable();

            References(x => x.Meta)
                .ColumnName("MetaId")
                .Not.Nullable();

            HasMany(x => x.UserStoryTagList)
                .KeyColumnNames.Add("UserStoryId");

            HasMany(x => x.UserStoryTaskList)
                .KeyColumnNames.Add("UserStoryId");
        }
    }
}